package com.backend.mapper;

import com.backend.entity.CarFlow;
import com.backend.entity.Vehicle;
import com.backend.entity.Warn;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface WebMapper {

    //查看全部流量信息
    @Select("SELECT * FROM flow limit #{pageNumber},#{pageSize};")
    List<CarFlow> listAll(Integer pageNumber, Integer pageSize);
    //查看流量信息数量
    @Select("SELECT count(*) FROM flow;")
    long listAllNum();

    //查看全部警报信息
    @Select("SELECT * FROM warn limit #{pageNumber},#{pageSize};")
    List<Warn> listAllWarn(Integer pageNumber, Integer pageSize);
    //查看警报信息数量
    @Select("SELECT count(*) FROM warn;")
    long listAllWarnNum();

    //查看全部车辆信息
    @Select("SELECT * FROM vehicle limit #{pageNumber},#{pageSize};")
    List<Vehicle> listAllVehicle(Integer pageNumber, Integer pageSize);
    //查看车辆信息数量
    @Select("SELECT count(*) FROM vehicle;")
    long listAllVehicleNum();

    //按时间和地点筛选流量信息
    List<CarFlow> listByTimeAndSpot(LocalDateTime beginTime, LocalDateTime endTime, String spot, Integer pageNumber, Integer pageSize);
    //按时间和地点筛选流量信息的数量
    long listByTimeAndSpotNum(LocalDateTime beginTime, LocalDateTime endTime, String spot);
}























